package com.riven.bilibilidemo.fragment;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.riven.bilibilidemo.utils.LogUtil;

/**
 * @author rivenlee
 * @date 2017/3/8 21:25
 */

public abstract class BaseFragment extends Fragment {
    protected Context mContext;

    @Override
    public void onAttach(Context context) {
        this.mContext = context;
        super.onAttach(context);
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(layoutID(),container,false);
        initViews(view);
        initData();
        return view;
    }

    public abstract int layoutID();
    protected abstract void initViews(View view);
    protected abstract void initData();

    public LogUtil getLog(){
        LogUtil logUtil = LogUtil.newInstance();
        return logUtil;
    }
}
